package com.shanhy.lixp.need001.dao;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import com.shanhy.lixp.need001.model.Company;

public interface ICompanyDao extends CrudRepository<Company, Integer> {

	@Transactional
	@Modifying
	@Query("update Company t set t.sno = :sno, t.sbisScope = :sbisScope, t.scontacts = :scontacts, t.saddress = :saddress where t.id = :id")
	int updateCompany(
			@Param("sno") String sno, 
			@Param("sbisScope") String sbisScope, 
			@Param("scontacts") String scontacts, 
			@Param("saddress") String saddress, 
			@Param("id") String id);

	@Query("select t from Company t where t.sname = :sname")
	Company getCompanyByName(@Param("sname") String sname);

}